﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NS.BLL.Systems;
using NS.Utilities;

public partial class _PassWord : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        ((Label)Master.FindControl("PageTitle")).Text = "<i class=\"arrow\"></i><span>修改密码</span>";
    }
    protected void ChangePassword_Click(object sender, EventArgs e)
    {
        string strErr = string.Empty;
        string Current = CurrentPassword.Text.Trim();
        string New = NewPassword.Text.Trim();
        string ConfirmNew = ConfirmNewPassword.Text.Trim();

        if (string.IsNullOrEmpty(Current))
        {
            strErr = "请输入原密码！";
        }
        else if (string.IsNullOrEmpty(New))
        {
            strErr = "请输入新密码！";
        }
        else if (string.IsNullOrEmpty(ConfirmNew))
        {
            strErr = "请输入确认密码！";
        }
        else if (New != ConfirmNew)
        {
            strErr = "确认密码和新密码不一致！";
        }
        else
        {
            strErr = UserDetailService.ChangePwd(CookieHelper.GetValue("uid"), EncryptHelper.Encrypt(Current), EncryptHelper.Encrypt(ConfirmNew));
        }
        FailureText.Text = strErr;
    }
}